<?php
/** @var MenuController $this */
/** @var Menu $model */
$this->breadcrumbs = array(
    'Menus' => array('index'),
    Yii::t('AweCrud.app', 'Manage'),
);

$this->menu = array(
    array('label' => Yii::t('AweCrud.app', 'List') . ' ' . Menu::label(2), 'icon' => 'list', 'url' => array('index')),
    array('label' => Yii::t('AweCrud.app', 'Create') . ' ' . Menu::label(), 'icon' => 'plus', 'url' => array('create')),
);
?>

<fieldset>
    <legend>
<?php echo Yii::t('AweCrud.app', 'Manage') ?> <?php echo Menu::label(2) ?>    </legend>


<?php
$this->widget('ext.selgridview.BootSelGridView', array(
    'id' => 'menu-grid',
    'type' => 'striped condensed',
    'dataProvider' => $model->search(),
    'filter' => $model,
    'columns' => array(
        'id',
        'nombre',
        'precio',
         array(
            'header' => 'Costo',
            'value' => 'isset($data->precio) ? number_format($data->obtenerPrecioCostoMenu(),2) : null',
//            'filter' => CHtml::listData(MenuSeccion::model()->findAll(), 'id', MenuSeccion::representingColumn()),
        ),
         array(
            'header' => 'Ganancia',
            'value' => 'isset($data->precio) ? number_format(($data->precio-$data->obtenerPrecioCostoMenu()),2) : null',
            'htmlOptions'=>array('class'=>'gananciaMenu')
//            'filter' => CHtml::listData(MenuSeccion::model()->findAll(), 'id', MenuSeccion::representingColumn()),
        ),
        array(
            'name' => 'seccion_id',
            'value' => 'isset($data->seccion) ? $data->seccion : null',
            'filter' => CHtml::listData(MenuSeccion::model()->findAll(), 'id', MenuSeccion::representingColumn()),
        ),
       
        'descripcion',
        'imagen',
        array(
            'class' => 'CButtonColumn',
//                    'class' => 'CButtonColumn',
            'template' => '{view}  {update}  ',
            'buttons' => array(
                'view' => array(
                    'label' => '<button class="btn btn-success"><i class=" icon-eye-open"></i></button>',
                    'options' => array('title' => 'Ver'),
                    'url' => 'Yii::app()->createUrl("menus/menu/view?id=".$data->id)',
                    'imageUrl' => false,
                ),
//                         'view' => array(
//                            'label' => '<button class="btn btn-success"><i class="icon-check"></i></button>',
//                            'options' => array('title' => 'Ver'),
//                            'imageUrl' => false,
//                        ),
                'update' => array(
                    'label' => '<button class="btn btn-primary"><i class=" icon-pencil"></i></button>',
                    'options' => array('title' => 'Actualizar'),
                    'url' => 'Yii::app()->createUrl("menus/menu/update?id=".$data->id)',
                    'imageUrl' => false,
                ),
                'delete' => array(
                    'label' => '<button class="btn btn-danger"><i class=" icon-trash"></i></button>',
                    'options' => array('title' => 'Eliminar'),
                    'imageUrl' => false,
                ),
            ),
            'htmlOptions' => array(
                'width' => '100px'
            )
        ),
    ),
));
?>
</fieldset>